package com.huang.community.controller;


import com.huang.community.util.EmailCilent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.thymeleaf.TemplateEngine;
import org.thymeleaf.context.Context;


@Controller
@Slf4j
public class HelloControl {
    @Autowired
    private TemplateEngine templateEngine;
    @Autowired
    private EmailCilent emailCilent;

    @GetMapping("/send")
    public String send(){
        Context context = new Context();
        context.setVariable("username","wyz");
        String content = templateEngine.process("email/htmlModel", context);
        emailCilent.sendHtmlMail("463839105@qq.com","test",content);
        return "/email/htmlModel" ;
    }
}
